home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / vb_eliza.zip / MAIN.FRM < prev    next >
Text File  |  1996-07-30  |  5KB  |  158 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Talk to ELIZA"
  5.    ClientHeight    =   4140
  6.    ClientLeft      =   765
  7.    ClientTop       =   1905
  8.    ClientWidth     =   7845
  9.    ControlBox      =   0   'False
  10.    Height          =   4545
  11.    Left            =   705
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4140
  16.    ScaleWidth      =   7845
  17.    ShowInTaskbar   =   0   'False
  18.    Top             =   1560
  19.    Width           =   7965
  20.    Begin VB.TextBox txtQuestion 
  21.       Height          =   285
  22.       Left            =   1680
  23.       TabIndex        =   0
  24.       Top             =   3120
  25.       Width           =   6015
  26.    End
  27.    Begin VB.CommandButton cmdExit 
  28.       Caption         =   "E&xit"
  29.       Height          =   375
  30.       Left            =   4560
  31.       TabIndex        =   2
  32.       Top             =   3600
  33.       Width           =   1455
  34.    End
  35.    Begin VB.CommandButton cmdOK 
  36.       Caption         =   "OK"
  37.       Height          =   375
  38.       Left            =   2520
  39.       TabIndex        =   1
  40.       Top             =   3600
  41.       Width           =   1455
  42.    End
  43.    Begin VB.Label Label3 
  44.       Caption         =   "Your conversation with ELIZA:"
  45.       BeginProperty Font 
  46.          name            =   "MS Sans Serif"
  47.          charset         =   1
  48.          weight          =   700
  49.          size            =   8.25
  50.          underline       =   0   'False
  51.          italic          =   0   'False
  52.          strikethrough   =   0   'False
  53.       EndProperty
  54.       Height          =   615
  55.       Left            =   120
  56.       TabIndex        =   7
  57.       Top             =   120
  58.       Width           =   1455
  59.    End
  60.    Begin VB.Label Label2 
  61.       Caption         =   "ELIZA replies:"
  62.       BeginProperty Font 
  63.          name            =   "MS Sans Serif"
  64.          charset         =   1
  65.          weight          =   700
  66.          size            =   8.25
  67.          underline       =   0   'False
  68.          italic          =   0   'False
  69.          strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   375
  72.       Left            =   120
  73.       TabIndex        =   6
  74.       Top             =   2400
  75.       Width           =   1455
  76.    End
  77.    Begin VB.Label Label1 
  78.       Caption         =   "Type your question here:"
  79.       BeginProperty Font 
  80.          name            =   "MS Sans Serif"
  81.          charset         =   1
  82.          weight          =   700
  83.          size            =   8.25
  84.          underline       =   0   'False
  85.          italic          =   0   'False
  86.          strikethrough   =   0   'False
  87.       EndProperty
  88.       Height          =   495
  89.       Left            =   120
  90.       TabIndex        =   5
  91.       Top             =   3000
  92.       Width           =   1455
  93.    End
  94.    Begin VB.Label lblReply 
  95.       BorderStyle     =   1  'Fixed Single
  96.       Height          =   375
  97.       Left            =   1680
  98.       TabIndex        =   4
  99.       Top             =   2400
  100.       Width           =   6015
  101.    End
  102.    Begin VB.Label lblConversation 
  103.       BorderStyle     =   1  'Fixed Single
  104.       Height          =   2055
  105.       Left            =   1680
  106.       TabIndex        =   3
  107.       Top             =   120
  108.       Width           =   6015
  109.    End
  110. End
  111. Attribute VB_Name = "frmMain"
  112. Attribute VB_Creatable = False
  113. Attribute VB_Exposed = False
  114. Dim Counter As Integer
  115. Private Sub cmdExit_Click()
  116.   End
  117. End Sub
  118.  
  119. Private Sub cmdOK_Click()
  120.   HandleReply
  121.   txtQuestion.SetFocus
  122. End Sub
  123.  
  124. Private Sub Form_Load()
  125.   lblReply.Caption = Greeting
  126. End Sub
  127.  
  128. Private Sub txtQuestion_KeyPress(KeyAscii As Integer)
  129.   If KeyAscii = 13 Then
  130.     HandleReply
  131.   End If
  132. End Sub
  133.  
  134. Public Sub HandleReply()
  135.   Const LOWER = 1
  136.   Const UPPER = 10
  137.   Static TalkArray(LOWER To UPPER) As String
  138.   Dim OldReply As String
  139.   Dim TempString As String
  140.   
  141.   NL = Chr(10) & Chr(13)
  142.   OldReply = lblReply.Caption
  143.   If lblConversation.Caption <> "" Then
  144.     For I = LOWER To UPPER - 2
  145.       TalkArray(I) = TalkArray(I + 2)
  146.     Next I
  147.   End If
  148.   TalkArray(9) = "ELIZA: " & lblReply.Caption
  149.   TalkArray(10) = txtQuestion.Text
  150.   TempString = ""
  151.   For I = LOWER To UPPER
  152.     TempString = TempString & TalkArray(I) & NL
  153.   Next I
  154.   lblConversation.Caption = TempString
  155.   lblReply.Caption = NewReply(OldReply, txtQuestion.Text)
  156.   txtQuestion.Text = ""
  157. End Sub
  158.